#include"comm.hpp"

int main()
{
    key_t key=getkey();
    cout<<key<<endl;
    int shmid=getshm(key);
    cout<<"shmid:"<<shmid<<endl;
    char* start=(char*)attachshm(shmid);
    printf("start:%p\n",start);

    const char* ch="我是client,正在给你发消息";
    pid_t id=getpid();
    int cnt=1;
    while(true)
    {
        snprintf(start,MAX_SIZE,"%s[%d][id:%d]\n",ch,cnt++,id);
        sleep(1);
    }

    dttachshm(start);
    return 0;
}